.class public Lcom/melesta/payment/PaymentExpansion;
.super Ljava/lang/Object;
.source "PaymentExpansion.java"

# interfaces
.implements Lcom/melesta/expansions/IEngineExpansion;


# annotations
.annotation system Ldalvik/annotation/MemberClasses;
    value = {
        Lcom/melesta/payment/PaymentExpansion$3;
    }
.end annotation


# instance fields
.field private defListener:Lcom/melesta/payment/interfaces/IListener;


# direct methods
.method public constructor <init>()V
    .locals 0

    .prologue
    .line 20
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 126
    return-void
.end method


# virtual methods
.method public onActivityResult(Landroid/content/Context;IILandroid/content/Intent;)V
    .locals 1
    .parameter "context"
    .parameter "requestCode"
    .parameter "resultCode"
    .parameter "data"

    .prologue
    .line 132
    invoke-static {}, Lcom/melesta/payment/PaymentManager;->getInstance()Lcom/melesta/payment/PaymentManager;

    move-result-object v0

    .line 133
    .local v0, pm:Lcom/melesta/payment/PaymentManager;
    invoke-virtual {v0, p1, p2, p3, p4}, Lcom/melesta/payment/PaymentManager;->onActivityResult(Landroid/content/Context;IILandroid/content/Intent;)Z

    .line 134
    return-void
.end method

.method public onActivitySateChange(Lcom/melesta/expansions/ActivityState;Landroid/content/Context;Landroid/os/Handler;)V
    .locals 6
    .parameter "state"
    .parameter "context"
    .parameter "handler"

    .prologue
    const/4 v1, 0x1

    const/4 v2, 0x0

    .line 46
    invoke-static {}, Lcom/melesta/payment/PaymentManager;->getInstance()Lcom/melesta/payment/PaymentManager;

    move-result-object v0

    .line 48
    .local v0, pm:Lcom/melesta/payment/PaymentManager;
    if-eqz p2, :cond_0

    iget-object v3, p0, Lcom/melesta/payment/PaymentExpansion;->defListener:Lcom/melesta/payment/interfaces/IListener;

    if-nez v3, :cond_0

    .line 49
    new-instance v3, Lcom/melesta/payment/listeners/ListenersMixer;

    const/4 v4, 0x2

    new-array v4, v4, [Lcom/melesta/payment/interfaces/IListener;

    new-instance v5, Lcom/melesta/payment/listeners/NativeListener;

    invoke-direct {v5}, Lcom/melesta/payment/listeners/NativeListener;-><init>()V

    aput-object v5, v4, v2

    new-instance v5, Lcom/melesta/payment/PaymentExpansion$1;

    invoke-direct {v5, p0, p2}, Lcom/melesta/payment/PaymentExpansion$1;-><init>(Lcom/melesta/payment/PaymentExpansion;Landroid/content/Context;)V

    aput-object v5, v4, v1

    invoke-direct {v3, v4}, Lcom/melesta/payment/listeners/ListenersMixer;-><init>([Lcom/melesta/payment/interfaces/IListener;)V

    iput-object v3, p0, Lcom/melesta/payment/PaymentExpansion;->defListener:Lcom/melesta/payment/interfaces/IListener;

    .line 86
    :cond_0
    sget-object v3, Lcom/melesta/payment/PaymentExpansion$3;->$SwitchMap$com$melesta$expansions$ActivityState:[I

    invoke-virtual {p1}, Lcom/melesta/expansions/ActivityState;->ordinal()I

    move-result v4

    aget v3, v3, v4

    packed-switch v3, :pswitch_data_0

    .line 128
    :goto_0
    :pswitch_0
    return-void

    .line 88
    :pswitch_1
    invoke-virtual {p2}, Landroid/content/Context;->getApplicationInfo()Landroid/content/pm/ApplicationInfo;

    move-result-object v3

    iget v3, v3, Landroid/content/pm/ApplicationInfo;->flags:I

    and-int/lit8 v3, v3, 0x2

    if-eqz v3, :cond_1

    :goto_1
    invoke-static {v1}, Lcom/tapjoy/TapjoyLog;->enableLogging(Z)V

    .line 90
    new-instance v1, Lcom/melesta/payment/inapp3/InAppSystem;

    invoke-direct {v1}, Lcom/melesta/payment/inapp3/InAppSystem;-><init>()V

    iget-object v2, p0, Lcom/melesta/payment/PaymentExpansion;->defListener:Lcom/melesta/payment/interfaces/IListener;

    invoke-virtual {v1, v2}, Lcom/melesta/payment/inapp3/InAppSystem;->setDefaultListener(Lcom/melesta/payment/interfaces/IListener;)Lcom/melesta/payment/inapp3/InAppSystem;

    move-result-object v1

    invoke-virtual {v0, v1}, Lcom/melesta/payment/PaymentManager;->addSystem(Lcom/melesta/payment/interfaces/ISystem;)V

    .line 91
    new-instance v1, Lcom/melesta/payment/amazon/PaymentSystem;

    invoke-direct {v1}, Lcom/melesta/payment/amazon/PaymentSystem;-><init>()V

    iget-object v2, p0, Lcom/melesta/payment/PaymentExpansion;->defListener:Lcom/melesta/payment/interfaces/IListener;

    invoke-virtual {v1, v2}, Lcom/melesta/payment/amazon/PaymentSystem;->setDefaultListener(Lcom/melesta/payment/interfaces/IListener;)Lcom/melesta/payment/interfaces/ISystem;

    move-result-object v1

    invoke-virtual {v0, v1}, Lcom/melesta/payment/PaymentManager;->addSystem(Lcom/melesta/payment/interfaces/ISystem;)V

    .line 95
    invoke-virtual {p2}, Landroid/content/Context;->getResources()Landroid/content/res/Resources;

    move-result-object v1

    sget v2, Lcom/melesta/engine/R$raw;->payment:I

    invoke-virtual {v1, v2}, Landroid/content/res/Resources;->openRawResource(I)Ljava/io/InputStream;

    move-result-object v1

    invoke-virtual {v0, v1}, Lcom/melesta/payment/PaymentManager;->load(Ljava/io/InputStream;)V

    .line 96
    invoke-virtual {v0, p2, p3}, Lcom/melesta/payment/PaymentManager;->onCreate(Landroid/content/Context;Landroid/os/Handler;)V

    .line 97
    invoke-static {}, Lcom/melesta/engine/EngineActivity;->getInstance()Lcom/melesta/engine/EngineActivity;

    move-result-object v1

    new-instance v2, Lcom/melesta/payment/PaymentExpansion$2;

    invoke-direct {v2, p0}, Lcom/melesta/payment/PaymentExpansion$2;-><init>(Lcom/melesta/payment/PaymentExpansion;)V

    invoke-virtual {v1, v2}, Lcom/melesta/engine/EngineActivity;->addTickListener(Lcom/melesta/engine/EngineActivity$ActivityTickListener;)V

    goto :goto_0

    :cond_1
    move v1, v2

    .line 88
    goto :goto_1

    .line 109
    :pswitch_2
    invoke-virtual {v0, p2, p3}, Lcom/melesta/payment/PaymentManager;->onDestroy(Landroid/content/Context;Landroid/os/Handler;)V

    goto :goto_0

    .line 112
    :pswitch_3
    invoke-virtual {v0, p2, p3}, Lcom/melesta/payment/PaymentManager;->onStart(Landroid/content/Context;Landroid/os/Handler;)V

    goto :goto_0

    .line 115
    :pswitch_4
    invoke-virtual {v0, p2, p3}, Lcom/melesta/payment/PaymentManager;->onStop(Landroid/content/Context;Landroid/os/Handler;)V

    goto :goto_0

    .line 86
    :pswitch_data_0
    .packed-switch 0x1
        :pswitch_1
        :pswitch_2
        :pswitch_3
        :pswitch_4
        :pswitch_0
        :pswitch_0
        :pswitch_0
        :pswitch_0
    .end packed-switch
.end method

.method public onAddExpansion()V
    .locals 0

    .prologue
    .line 27
    return-void
.end method

.method public onRemoveExpansion()V
    .locals 0

    .prologue
    .line 32
    return-void
.end method

.method public resendTransaction(Ljava/lang/String;IJ)V
    .locals 4
    .parameter "name"
    .parameter "quantity"
    .parameter "id"

    .prologue
    .line 35
    new-instance v2, Lcom/melesta/payment/inapp3/InAppResponse;

    invoke-direct {v2}, Lcom/melesta/payment/inapp3/InAppResponse;-><init>()V

    invoke-virtual {v2, p1}, Lcom/melesta/payment/inapp3/InAppResponse;->setName(Ljava/lang/String;)Lcom/melesta/payment/inapp3/InAppResponse;

    move-result-object v2

    sget-object v3, Lcom/melesta/payment/inapp3/InAppResponse$Status;->PURCHASED:Lcom/melesta/payment/inapp3/InAppResponse$Status;

    invoke-virtual {v2, v3}, Lcom/melesta/payment/inapp3/InAppResponse;->setStatus(Lcom/melesta/payment/inapp3/InAppResponse$Status;)Lcom/melesta/payment/inapp3/InAppResponse;

    move-result-object v2

    invoke-virtual {v2, p2}, Lcom/melesta/payment/inapp3/InAppResponse;->setCountPerItem(I)Lcom/melesta/payment/inapp3/InAppResponse;

    move-result-object v2

    iget-object v3, p0, Lcom/melesta/payment/PaymentExpansion;->defListener:Lcom/melesta/payment/interfaces/IListener;

    invoke-virtual {v2, v3}, Lcom/melesta/payment/inapp3/InAppResponse;->setListener(Lcom/melesta/payment/interfaces/IListener;)Lcom/melesta/payment/inapp3/InAppResponse;

    move-result-object v0

    .line 38
    .local v0, inAppResponse:Lcom/melesta/payment/inapp3/InAppResponse;
    invoke-virtual {v0, p3, p4}, Lcom/melesta/payment/inapp3/InAppResponse;->setInternalId(J)V

    .line 40
    invoke-static {}, Lcom/melesta/payment/PaymentManager;->getInstance()Lcom/melesta/payment/PaymentManager;

    move-result-object v1

    .line 41
    .local v1, pm:Lcom/melesta/payment/PaymentManager;
    invoke-virtual {v1, v0}, Lcom/melesta/payment/PaymentManager;->postResponse(Lcom/melesta/payment/interfaces/IResponse;)V

    .line 42
    return-void
.end method
